package com.example.myapplication.apter;

import android.content.Context;
import android.content.Intent;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;

import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;

import com.bumptech.glide.Glide;
import com.example.myapplication.R;

import com.example.myapplication.ShuJu.LogisticsinquirynoBean;


import java.util.List;

public class LogisticsdetailsApter extends RecyclerView.Adapter<LogisticsdetailsApter.MyHolder>{
    private Context context;
    private List<LogisticsinquirynoBean.DataBean.StepListBean> list;

    public LogisticsdetailsApter(Context context, List<LogisticsinquirynoBean.DataBean.StepListBean> list) {
        this.context = context;
        this.list = list;
    }

    @NonNull
    @Override
    public LogisticsdetailsApter.MyHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
        View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.item_logisticsdetails,null);
        return new LogisticsdetailsApter.MyHolder(view);
    }

    @Override
    public void onBindViewHolder(@NonNull LogisticsdetailsApter.MyHolder holder, int position) {
       holder.addressAt.setText(list.get(position).getAddressAt());
       holder.eventAt.setText(list.get(position).getEventAt());
       holder.stateName.setText(list.get(position).getStateName());
    }

    @Override
    public int getItemCount() {
        return list == null ? 0 : list.size();
    }

    class MyHolder extends RecyclerView.ViewHolder {

        private final TextView addressAt;
        private final TextView eventAt;
        private final TextView stateName;

        public MyHolder(@NonNull View itemView) {
            super(itemView);
            stateName = itemView.findViewById(R.id.stateName);
            eventAt = itemView.findViewById(R.id.eventAt);
            addressAt = itemView.findViewById(R.id.addressAt);
        }
    }
}


